package com.snoob.springboot.log.controller;


import com.alibaba.fastjson.JSONObject;
import com.snoob.springboot.base.BaseLogEntity;
import com.snoob.springboot.base.BasePageResult;
import com.snoob.springboot.log.entity.SysLogEntity;
import com.snoob.springboot.log.service.SysLogService;
import com.snoob.springboot.pipleline.qo.SelectSysLogQo;
import com.snoob.springboot.pipleline.vo.DeleteSysLogVoReq;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <p>
 * 系统日志 前端控制器
 * </p>
 *
 * @author lixing_java@163.com
 * @since 2022-05-17
 */
//@RestController
//@RequestMapping("/sys-log-entity")
@Component
public class SysLogController {
    @Resource
    private SysLogService sysLogService;

    /**
     * @描述 添加日志信息 // TODO 单一功能接口
     */
    public Long insertSysLog(BaseLogEntity baseLogEntity) {
        SysLogEntity sysLogEntity = JSONObject.parseObject(JSONObject.toJSONString(baseLogEntity), SysLogEntity.class);
        Long id = sysLogService.insertSysLog(sysLogEntity);
        return id;
    }

    /**
     * @描述 删除日志信息 // TODO 单一功能接口
     */
    public Boolean deleteSysLog(DeleteSysLogVoReq vo) {
        return sysLogService.deleteSysLog(vo);
    }

    /**
     * @描述 查询日志信息 // TODO 单一功能接口
     */
    public SysLogEntity selectSysLog(SelectSysLogQo qo) {
        return sysLogService.selectSysLog(qo);
    }

    /**
     * @描述 分页查询企业信息 // TODO 单一功能接口
     */
    public BasePageResult<SysLogEntity> selectEnterpriseByPage(SelectSysLogQo qo) {
        return sysLogService.selectSysLogByPage(qo);
    }
}

